package main.java.com.action;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * !!! Anti-fake label !!!
 * ClassName: LoginOutAction
 * Package: main.java.com.action
 * Description:
 *
 * @Author 22软件6班 陈彬
 * @Create 2023/12/6 8:20
 * @Version 1.0
 **/
@WebServlet("/LoginOutServlet")
public class LoginOutAction extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        //清空Session值
        request.getSession().invalidate();

        //String userName=request.getSession().getAttribute("userName").toString();
        //System.out.println(userName);

        //实现跳转登录页面
        //getRequestDispatchar获取转发对象
        request.getRequestDispatcher("/WEB-INF/jsp/login.jsp").forward(request,response);
    }
}
